# ifndef __NodeProperties_H_
# define __NodeProperties_H_

struct rgn_t;
void ShowNodeProperties (HWND _hWnd, rgn_t & _rgn, size_t _cElement, size_t _cPoint);

struct rgnode_t;

//////////////////////////////////////////////////////////////////////
// INTERNAL USE ONLY.

struct node_extra_base_t {
	virtual ~node_extra_base_t () {}
};

# include "PropertyPages.h"

class CNodeProperties : public CPropertyPages {
  public:
	CNodeProperties () : pExtra (NULL) {}
	~CNodeProperties () {delete pExtra;}

	rgn_t * pRgn;
	size_t cElement;
	size_t cPoint;
	node_extra_base_t * pExtra;
};

class CNodePage : public CPropertyPages::CPage {
  public:
	CNodePage () : CPropertyPages::CPage (IDD_NODE) {}
	 
	// Override.
	virtual bool OnInit (HWND _hwndFocus);
	virtual void OnCommand (WORD _wCmd, WORD _wNotifyCode, HWND _hwndCtl);
	virtual void OnActivatePage (const PSHNOTIFY *);
	virtual void OnApply        (const PSHNOTIFY *);
};

class CNodeRoutingPage : public CPropertyPages::CPage {
  public:
	CNodeRoutingPage () : CPropertyPages::CPage (IDD_NODE_ROUTING), m_hList (NULL) {}
	 
	// Override.
	virtual bool OnInit (HWND _hwndFocus);
	virtual void OnCommand (WORD _wCmd, WORD _wNotifyCode, HWND _hwndCtl);
	virtual bool OnNotify (int _idCtrl, NMHDR * _pInfo);
	virtual void OnActivatePage (const PSHNOTIFY *);
	virtual void OnApply        (const PSHNOTIFY *);

  private:
	void _PrepareRestrictionsImages (CNodeProperties * _pData, rgnode_t * _pNode, size_t _cLevel);
	void _EnableRGNodeCtrls (bool _bEnable);

	HWND m_hList;
};

struct city_t;
struct zip_t;

class CNodeNumbersPage : public CPropertyPages::CPage {
  public:
	CNodeNumbersPage () :
		CPropertyPages::CPage (IDD_NODE_NUMBERS),
		m_hLeftParity (NULL),
		m_hRightParity (NULL),
		m_pCityLeft (NULL),
		m_pCityRight (NULL),
		m_pZipLeft (NULL),
		m_pZipRight (NULL),
		m_bLastPoint (false),
		m_bEnableLeftBefore (false),
		m_bEnableRightBefore (false)
	{}
	 
	// Override.
	virtual bool OnInit (HWND _hwndFocus);
	virtual void OnCommand (WORD _wCmd, WORD _wNotifyCode, HWND _hwndCtl);
	virtual void OnActivatePage (const PSHNOTIFY *);
	virtual void OnApply        (const PSHNOTIFY *);

  private:
	HWND m_hLeftParity, m_hRightParity;

	void _EnableAll          (bool _bEnable);
	void _EnableLeftNumbers  (bool _bEnable);
	void _EnableRightNumbers (bool _bEnable);

	void _FillCityLeft  ();
	void _FillCityRight ();
	void _FillZipLeft   ();
	void _FillZipRight  ();

	city_t * m_pCityLeft;
	city_t * m_pCityRight;
	zip_t  * m_pZipLeft;
	zip_t  * m_pZipRight;

	bool m_bLastPoint;
	bool m_bEnableLeftBefore;
	bool m_bEnableRightBefore;
};

# endif // __NodeProperties_H_
